import { request } from "@/common/request";
// +---------------------
// | 会员
// +---------------------

/**
 * 会员列表
 * @returns
 */
export function getVipAccountList(data: any) {
  return request({
    // url: `/kingon-customer/account/vipAccountList`,
    url: `/kingon-customer/account/vipCustomerAccountPage`,
    method: "get",
    data,
  });
}

/**
 * 会员详情 (比 会员列表少部分字段..)
 */
export function getAccountInfoById(data: any) {
  return request({
    url: `/kingon-customer/account/accountInfoById`,
    method: "get",
    data,
  });
}

/**
 * 获取用户账户
 */
export function accountInfoByProcurementItemsId(data: any) {
  return request({
    url: `/kingon-customer/account/accountInfoByProcurementItemsId`,
    method: "get",
    data,
  });
}

/**
 * 用kehuid 查询账户 余额查询
 * @param data {accountType,customerId}
 * @returns
 */
export function accountInfoByCustomerId(data: any) {
  return request({
    url: `/kingon-customer/account/accountInfoByCustomerId`,
    method: "get",
    data,
  });
}

/**
 * 绑定会员卡
 */
export function bindingMembership(data: any) {
  return request({
    url: `/kingon-customer/membership/binding`,
    method: "post",
    data,
  });
}

/**
 * 绑定会员卡
 */
export function appBindingMembership(data: any) {
  return request({
    url: `/kingon-customer/membership/appBinding`,
    method: "post",
    data,
  });
}

/**
 * 会员卡充值
 */
export function rechargeMembership(data: any) {
  return request({
    url: `/kingon-customer/membership/recharge`,
    method: "post",
    data,
  });
}

/**
 * 通过客户id 获取会员卡
 */
export function getCardByCustomerId(data: any) {
  return request({
    url: `/kingon-customer/membership/getCardByCustomerId`,
    method: "get",
    data,
  });
}

/**
 * 根据物理卡获取老人信息
 */
export function getCustomerInfoByCard(data: any) {
  return request({
    url: `/kingon-customer/membership/getCustomerInfoByCard`,
    method: "get",
    data,
  });
}

/**
 *  账户信息修改 （可用于客户余额、积分账户修改）
 */
export function accountEdit(data: any) {
  return request({
    url: `/kingon-customer/account/edit`,
    method: "post",
    data,
  });
}

/**
 *  客户信息修改
 */
export function customerEdit(data: any) {
  return request({
    url: `/kingon-customer/information/edit`,
    method: "post",
    data,
  });
}

/**
 *  开卡 -  根据物理卡号生成会员卡号 或 校验卡是否存在 （autoCard	1读卡2自动生成卡号）
 */
export function createCardNo(data: any) {
  return request({
    url: `/kingon-customer/membership/readCard`,
    method: "get",
    data,
  });
}

/**
 *  卡挂失 / 注销
 */
export function loseOrCancel(data: any) {
  return request({
    url: `/kingon-customer/membership/loseOrCancel`,
    method: "post",
    data,
  });
}

/**
 *  更新卡状态 /  解挂失
 */
export function membershipUpdate(data: any) {
  return request({
    url: `/kingon-customer/membership/update`,
    method: "post",
    data,
  });
}

/**
 *  会员卡充值退款
 */
export function rechargeRefund(data: any) {
  return request({
    url: `/kingon-customer/account/refund`,
    method: "post",
    data,
  });
}

/**
 *  删除老人（注销）
 */
export function membershipRemove(data: any) {
  return request({
    url: `/kingon-customer/information/removeCustomerByMachine`,
    method: "post",
    data,
    /** 特殊 post + url传参 */
    params:data
  });
}

/**
 *  会员卡充值退款（消费机）（x @2025/02/12 更新使用和PC一致的端口）
 */
export function memberShipCardRefund(data: any) {
  return request({
    url: `/kingon-customer/machineApi/memberShipCardRefund`,
    method: "post",
    data,
  });
}

/**
 *  会员卡更换
 */
export function changeCard(data: any) {
  return request({
    url: `/kingon-customer/membership/changeCard`,
    method: "post",
    data,
  });
}

/**
 *  账户流水 
 */
export function customerBalancePage(data: any) {
  return request({
    url: `/kingon-customer/customer/customerAccountRecord/list`,
    method: "get",
    data,
  });
}
/**
 *  余额明细( accountType: 1)
 */
export function vipBalanceDetailAccountList(data: any) {
  return request({
    url: `/kingon-customer/account/vipDetailAccountList`,
    method: "get",
    data,
  });
}
